package com.ruoyi.project.drug.service.impl;

import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.drug.domain.DruDrug;
import com.ruoyi.project.drug.domain.DruManufacturer;
import com.ruoyi.project.drug.mapper.DruManufacturerMapper;
import com.ruoyi.project.drug.service.DruManufacturerService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Service
public class DruManufacturerServiceImpl implements DruManufacturerService {


    @Autowired
    private DruManufacturerMapper druManufacturerMapper;



    /**
     * 无条件查询所有生产工厂信息
     *
     * @return 返回所有数据集合
     */
    @Override
    public List<DruManufacturer> selectManufacturer() {
        return druManufacturerMapper.selectManufacturer();
    }


    /**
     * 根据条件进行查询，在使用对数据进行分页显示
     *
     * @param druManufacturer  条件查询参数
     * @return  返回查询结果集合
     */
    @Override
    public List<DruManufacturer> selectAll(DruManufacturer druManufacturer) {
        return druManufacturerMapper.selectAll(druManufacturer);
    }



    /**
     *添加生产厂家
     *
     * @param druManufacturer 用来传递生产厂家的参数数据
     * @return  返回 1 成功  否则失败
     */
    @Override
    public int addManufacturer(DruManufacturer druManufacturer) {
        return druManufacturerMapper.addManufacturer(druManufacturer);
    }


    /**
     * 根据id查询单个生产厂家信息进行数据回显
     *
     * @param dmid  生产厂家主键id
     * @return  返回查询结果
     */
    @Override
    public DruManufacturer selectOne(@PathVariable int dmid) {
        return druManufacturerMapper.selectOne(dmid);
    }



    /**
     * 修改生产厂家信息
     *
     * @param druManufacturer  用来传递生产厂家的参数数据
     * @return  返回 1 修改成功  否则失败
     */
    @Override
    public int updateManufacturer(DruManufacturer druManufacturer) {
        return druManufacturerMapper.updateManufacturer(druManufacturer);
    }



    /**
     * 根据主键删除单条或多条生产厂家信息
     *
     * @param dmids  生产厂家主键id数组
     * @return  返回 1 删除成功  否则失败
     */
    @Override
    public int deleteManufacturer(int[] dmids) {
        return druManufacturerMapper.deleteManufacturer(dmids);
    }
}
